/**
 * 
 */
package com.oron3.bouncer.objects.shapes;

/**
 * @author Ofek
 *
 */
public class Cylinder implements Shape {
	private final float radius;
	private final Line l;

	/**
	 * 
	 */
	public Cylinder(final Line touchLine, final float radius) {
		l = touchLine;
		this.radius = radius;
	}



	/*
	 * (non-Javadoc)
	 * 
	 * @see com.oron3.bouncer.objects.shapes.Shape#intersects(com.oron3.bouncer.objects.shapes.Shape)
	 */
	@Override
	public boolean intersects(final Shape o) {
		if (o instanceof Sphere) {
			final Sphere s = (Sphere) o;
			final Shape project = l.project(s.center);
			return ((Point)project).distance(s.center) <= s.r + radius;
		}
		return false;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.oron3.bouncer.objects.shapes.Shape#intersection(com.oron3.bouncer.objects.shapes.Shape)
	 */
	@Override
	public Intersection intersection(final Shape o) {
		return null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.oron3.bouncer.objects.shapes.Shape#calcRelation(com.oron3.bouncer.objects.shapes.Shape)
	 */
	@Override
	public int describeRelation(final Shape o) {
		throw new IllegalArgumentException();
	}



	/* (non-Javadoc)
	 * @see com.oron3.bouncer.objects.shapes.Shape#isInside(com.oron3.bouncer.objects.shapes.Shape)
	 */
	@Override
	public boolean isInside(final Shape o) {
		throw new IllegalArgumentException();
	}



	/* (non-Javadoc)
	 * @see com.oron3.bouncer.objects.shapes.Shape#project(com.oron3.bouncer.objects.shapes.Shape)
	 */
	@Override
	public Shape project(final Shape o) {
		throw new IllegalArgumentException();
	}

}
